<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LINE 1 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-1"></span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LINE 2 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-3"></span><span>
</span><span id="line-4"></span><span class="hs-pragma">{-# LINE 6 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-6"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Module      :  System.Win32.File</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Copyright   :  (c) Alastair Reid, 1997-2003</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-11"></span><span class="hs-comment">--</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Maintainer  :  Esa Ilari Vuokko &lt;ei@vuokko.info&gt;</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Stability   :  provisional</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- A collection of FFI declarations for interfacing with Win32.</span><span>
</span><span id="line-17"></span><span class="hs-comment">--</span><span>
</span><span id="line-18"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">System.Win32.File</span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">(</span><span> </span><span class="hs-comment">-- * Access modes</span><span>
</span><span id="line-22"></span><span>      </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-23"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gENERIC_NONE</span><span>
</span><span id="line-24"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gENERIC_READ</span><span>
</span><span id="line-25"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gENERIC_WRITE</span><span>
</span><span id="line-26"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gENERIC_EXECUTE</span><span>
</span><span id="line-27"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">gENERIC_ALL</span><span>
</span><span id="line-28"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dELETE</span><span>
</span><span id="line-29"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">rEAD_CONTROL</span><span>
</span><span id="line-30"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">wRITE_DAC</span><span>
</span><span id="line-31"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">wRITE_OWNER</span><span>
</span><span id="line-32"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sYNCHRONIZE</span><span>
</span><span id="line-33"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sTANDARD_RIGHTS_REQUIRED</span><span>
</span><span id="line-34"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sTANDARD_RIGHTS_READ</span><span>
</span><span id="line-35"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sTANDARD_RIGHTS_WRITE</span><span>
</span><span id="line-36"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sTANDARD_RIGHTS_EXECUTE</span><span>
</span><span id="line-37"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sTANDARD_RIGHTS_ALL</span><span>
</span><span id="line-38"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sPECIFIC_RIGHTS_ALL</span><span>
</span><span id="line-39"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">aCCESS_SYSTEM_SECURITY</span><span>
</span><span id="line-40"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mAXIMUM_ALLOWED</span><span>
</span><span id="line-41"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ADD_FILE</span><span>
</span><span id="line-42"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ADD_SUBDIRECTORY</span><span>
</span><span id="line-43"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ALL_ACCESS</span><span>
</span><span id="line-44"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_APPEND_DATA</span><span>
</span><span id="line-45"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_CREATE_PIPE_INSTANCE</span><span>
</span><span id="line-46"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_DELETE_CHILD</span><span>
</span><span id="line-47"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_EXECUTE</span><span>
</span><span id="line-48"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_LIST_DIRECTORY</span><span>
</span><span id="line-49"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_READ_ATTRIBUTES</span><span>
</span><span id="line-50"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_READ_DATA</span><span>
</span><span id="line-51"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_READ_EA</span><span>
</span><span id="line-52"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_TRAVERSE</span><span>
</span><span id="line-53"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_WRITE_ATTRIBUTES</span><span>
</span><span id="line-54"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_WRITE_DATA</span><span>
</span><span id="line-55"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_WRITE_EA</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span>      </span><span class="hs-comment">-- * Sharing modes</span><span>
</span><span id="line-58"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ShareMode</span><span>
</span><span id="line-59"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_SHARE_NONE</span><span>
</span><span id="line-60"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_SHARE_READ</span><span>
</span><span id="line-61"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_SHARE_WRITE</span><span>
</span><span id="line-62"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_SHARE_DELETE</span><span>
</span><span id="line-63"></span><span>
</span><span id="line-64"></span><span>      </span><span class="hs-comment">-- * Creation modes</span><span>
</span><span id="line-65"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">CreateMode</span><span>
</span><span id="line-66"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">cREATE_NEW</span><span>
</span><span id="line-67"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">cREATE_ALWAYS</span><span>
</span><span id="line-68"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">oPEN_EXISTING</span><span>
</span><span id="line-69"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">oPEN_ALWAYS</span><span>
</span><span id="line-70"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">tRUNCATE_EXISTING</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span>      </span><span class="hs-comment">-- * File attributes and flags</span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_READONLY</span><span>
</span><span id="line-75"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_HIDDEN</span><span>
</span><span id="line-76"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_SYSTEM</span><span>
</span><span id="line-77"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_DIRECTORY</span><span>
</span><span id="line-78"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_ARCHIVE</span><span>
</span><span id="line-79"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_NORMAL</span><span>
</span><span id="line-80"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_TEMPORARY</span><span>
</span><span id="line-81"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_COMPRESSED</span><span>
</span><span id="line-82"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_ATTRIBUTE_REPARSE_POINT</span><span>
</span><span id="line-83"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_WRITE_THROUGH</span><span>
</span><span id="line-84"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_OVERLAPPED</span><span>
</span><span id="line-85"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_NO_BUFFERING</span><span>
</span><span id="line-86"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_RANDOM_ACCESS</span><span>
</span><span id="line-87"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_SEQUENTIAL_SCAN</span><span>
</span><span id="line-88"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_DELETE_ON_CLOSE</span><span>
</span><span id="line-89"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_BACKUP_SEMANTICS</span><span>
</span><span id="line-90"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_FLAG_POSIX_SEMANTICS</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span class="hs-pragma">{-# LINE 92 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_ANONYMOUS</span><span>
</span><span id="line-93"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_IDENTIFICATION</span><span>
</span><span id="line-94"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_IMPERSONATION</span><span>
</span><span id="line-95"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_DELEGATION</span><span>
</span><span id="line-96"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_CONTEXT_TRACKING</span><span>
</span><span id="line-97"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_EFFECTIVE_ONLY</span><span>
</span><span id="line-98"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_SQOS_PRESENT</span><span>
</span><span id="line-99"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sECURITY_VALID_SQOS_FLAGS</span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span class="hs-pragma">{-# LINE 101 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>      </span><span class="hs-comment">-- * Move file flags</span><span>
</span><span id="line-103"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span>
</span><span id="line-104"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mOVEFILE_REPLACE_EXISTING</span><span>
</span><span id="line-105"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mOVEFILE_COPY_ALLOWED</span><span>
</span><span id="line-106"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">mOVEFILE_DELAY_UNTIL_REBOOT</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span>      </span><span class="hs-comment">-- * File pointer directions</span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_BEGIN</span><span>
</span><span id="line-111"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_CURRENT</span><span>
</span><span id="line-112"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_END</span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span>      </span><span class="hs-comment">-- * Drive types</span><span>
</span><span id="line-115"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-116"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_UNKNOWN</span><span>
</span><span id="line-117"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_NO_ROOT_DIR</span><span>
</span><span id="line-118"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_REMOVABLE</span><span>
</span><span id="line-119"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_FIXED</span><span>
</span><span id="line-120"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_REMOTE</span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_CDROM</span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dRIVE_RAMDISK</span><span>
</span><span id="line-123"></span><span>
</span><span id="line-124"></span><span>      </span><span class="hs-comment">-- * Define DOS device flags</span><span>
</span><span id="line-125"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span>
</span><span id="line-126"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dDD_RAW_TARGET_PATH</span><span>
</span><span id="line-127"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dDD_REMOVE_DEFINITION</span><span>
</span><span id="line-128"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">dDD_EXACT_MATCH_ON_REMOVE</span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span>      </span><span class="hs-comment">-- * Binary types</span><span>
</span><span id="line-131"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-132"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sCS_32BIT_BINARY</span><span>
</span><span id="line-133"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sCS_DOS_BINARY</span><span>
</span><span id="line-134"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sCS_WOW_BINARY</span><span>
</span><span id="line-135"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sCS_PIF_BINARY</span><span>
</span><span id="line-136"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sCS_POSIX_BINARY</span><span>
</span><span id="line-137"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">sCS_OS216_BINARY</span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span>      </span><span class="hs-comment">-- * File notification flags</span><span>
</span><span id="line-140"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-141"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_NOTIFY_CHANGE_FILE_NAME</span><span>
</span><span id="line-142"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_NOTIFY_CHANGE_DIR_NAME</span><span>
</span><span id="line-143"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_NOTIFY_CHANGE_ATTRIBUTES</span><span>
</span><span id="line-144"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_NOTIFY_CHANGE_SIZE</span><span>
</span><span id="line-145"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_NOTIFY_CHANGE_LAST_WRITE</span><span>
</span><span id="line-146"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_NOTIFY_CHANGE_SECURITY</span><span>
</span><span id="line-147"></span><span>
</span><span id="line-148"></span><span>      </span><span class="hs-comment">-- * File types</span><span>
</span><span id="line-149"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-150"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_TYPE_UNKNOWN</span><span>
</span><span id="line-151"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_TYPE_DISK</span><span>
</span><span id="line-152"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_TYPE_CHAR</span><span>
</span><span id="line-153"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_TYPE_PIPE</span><span>
</span><span id="line-154"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fILE_TYPE_REMOTE</span><span>
</span><span id="line-155"></span><span>
</span><span id="line-156"></span><span>      </span><span class="hs-comment">-- * Lock modes</span><span>
</span><span id="line-157"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LockMode</span><span>
</span><span id="line-158"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">lOCKFILE_EXCLUSIVE_LOCK</span><span>
</span><span id="line-159"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">lOCKFILE_FAIL_IMMEDIATELY</span><span>
</span><span id="line-160"></span><span>
</span><span id="line-161"></span><span>      </span><span class="hs-comment">-- * GetFileEx information levels</span><span>
</span><span id="line-162"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFileExInfoStandard</span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFileExMaxInfoLevel</span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span>      </span><span class="hs-comment">-- * Security attributes</span><span>
</span><span id="line-167"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">PSECURITY_ATTRIBUTES</span><span>
</span><span id="line-169"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span>
</span><span id="line-170"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">MbLPSECURITY_ATTRIBUTES</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>      </span><span class="hs-comment">-- * BY_HANDLE file information</span><span>
</span><span id="line-173"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span>      </span><span class="hs-comment">-- * Win32 file attribute data</span><span>
</span><span id="line-176"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">WIN32_FILE_ATTRIBUTE_DATA</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-177"></span><span>
</span><span id="line-178"></span><span>      </span><span class="hs-comment">-- * Helpers</span><span>
</span><span id="line-179"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failIfWithRetry</span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failIfWithRetry_</span><span>
</span><span id="line-181"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">failIfFalseWithRetry_</span><span>
</span><span id="line-182"></span><span>      </span><span class="hs-comment">-- * File operations</span><span>
</span><span id="line-183"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">deleteFile</span><span>
</span><span id="line-184"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">copyFile</span><span>
</span><span id="line-185"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">moveFile</span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">moveFileEx</span><span>
</span><span id="line-187"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setCurrentDirectory</span><span>
</span><span id="line-188"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">createDirectory</span><span>
</span><span id="line-189"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">createDirectoryEx</span><span>
</span><span id="line-190"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">removeDirectory</span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getBinaryType</span><span>
</span><span id="line-192"></span><span>
</span><span id="line-193"></span><span>      </span><span class="hs-comment">-- * HANDLE operations</span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">createFile</span><span>
</span><span id="line-195"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">closeHandle</span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFileType</span><span>
</span><span id="line-197"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">flushFileBuffers</span><span>
</span><span id="line-198"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setEndOfFile</span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setFileAttributes</span><span>
</span><span id="line-200"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFileAttributes</span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFileAttributesExStandard</span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFileInformationByHandle</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span>      </span><span class="hs-comment">-- ** Reading/writing</span><span>
</span><span id="line-205"></span><span>      </span><span class="hs-comment">-- | Some operations below bear the @win32_@ prefix to avoid shadowing</span><span>
</span><span id="line-206"></span><span>      </span><span class="hs-comment">-- operations from &quot;Prelude&quot;.</span><span>
</span><span id="line-207"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">MbLPOVERLAPPED</span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">win32_ReadFile</span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">win32_WriteFile</span><span>
</span><span id="line-212"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setFilePointerEx</span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span>      </span><span class="hs-comment">-- * File notifications</span><span>
</span><span id="line-215"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">findFirstChangeNotification</span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">findNextChangeNotification</span><span>
</span><span id="line-217"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">findCloseChangeNotification</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span>      </span><span class="hs-comment">-- * Directories</span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FindData</span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getFindDataFileName</span><span>
</span><span id="line-222"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">findFirstFile</span><span>
</span><span id="line-223"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">findNextFile</span><span>
</span><span id="line-224"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">findClose</span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span>      </span><span class="hs-comment">-- * DOS device flags</span><span>
</span><span id="line-227"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">defineDosDevice</span><span>
</span><span id="line-228"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">areFileApisANSI</span><span>
</span><span id="line-229"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setFileApisToOEM</span><span>
</span><span id="line-230"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setFileApisToANSI</span><span>
</span><span id="line-231"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setHandleCount</span><span>
</span><span id="line-232"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getLogicalDrives</span><span>
</span><span id="line-233"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">getDiskFreeSpace</span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">setVolumeLabel</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>      </span><span class="hs-comment">-- * File locks</span><span>
</span><span id="line-237"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">lockFile</span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">unlockFile</span><span>
</span><span id="line-239"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-240"></span><span>
</span><span id="line-241"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Types</span><span>
</span><span id="line-242"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">System.Win32.Time</span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Foreign</span><span> </span><span class="hs-keyword">hiding</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">void</span><span class="hs-special">)</span><span>
</span><span id="line-245"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Monad</span><span>
</span><span id="line-246"></span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Control.Concurrent</span><span class="hs-cpp">

#include &quot;windows_cconv.h&quot;
</span><span>
</span><span id="line-250"></span><span>
</span><span id="line-251"></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-254"></span><span class="hs-comment">-- Enumeration types</span><span>
</span><span id="line-255"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">AccessMode</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-258"></span><span>
</span><span id="line-259"></span><span class="hs-identifier">gENERIC_NONE</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-260"></span><span class="hs-identifier">gENERIC_NONE</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-261"></span><span>
</span><span id="line-262"></span><span class="hs-identifier">gENERIC_READ</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-263"></span><span class="hs-identifier">gENERIC_READ</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2147483648</span><span>
</span><span id="line-264"></span><span class="hs-identifier">gENERIC_WRITE</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-265"></span><span class="hs-identifier">gENERIC_WRITE</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1073741824</span><span>
</span><span id="line-266"></span><span class="hs-identifier">gENERIC_EXECUTE</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-267"></span><span class="hs-identifier">gENERIC_EXECUTE</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">536870912</span><span>
</span><span id="line-268"></span><span class="hs-identifier">gENERIC_ALL</span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-269"></span><span class="hs-identifier">gENERIC_ALL</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">268435456</span><span>
</span><span id="line-270"></span><span class="hs-identifier">dELETE</span><span>                     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-271"></span><span class="hs-identifier">dELETE</span><span>                     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">65536</span><span>
</span><span id="line-272"></span><span class="hs-identifier">rEAD_CONTROL</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-273"></span><span class="hs-identifier">rEAD_CONTROL</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131072</span><span>
</span><span id="line-274"></span><span class="hs-identifier">wRITE_DAC</span><span>                  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-275"></span><span class="hs-identifier">wRITE_DAC</span><span>                  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">262144</span><span>
</span><span id="line-276"></span><span class="hs-identifier">wRITE_OWNER</span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-277"></span><span class="hs-identifier">wRITE_OWNER</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">524288</span><span>
</span><span id="line-278"></span><span class="hs-identifier">sYNCHRONIZE</span><span>                </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-279"></span><span class="hs-identifier">sYNCHRONIZE</span><span>                </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1048576</span><span>
</span><span id="line-280"></span><span class="hs-identifier">sTANDARD_RIGHTS_REQUIRED</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-281"></span><span class="hs-identifier">sTANDARD_RIGHTS_REQUIRED</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">983040</span><span>
</span><span id="line-282"></span><span class="hs-identifier">sTANDARD_RIGHTS_READ</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-283"></span><span class="hs-identifier">sTANDARD_RIGHTS_READ</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131072</span><span>
</span><span id="line-284"></span><span class="hs-identifier">sTANDARD_RIGHTS_WRITE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-285"></span><span class="hs-identifier">sTANDARD_RIGHTS_WRITE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131072</span><span>
</span><span id="line-286"></span><span class="hs-identifier">sTANDARD_RIGHTS_EXECUTE</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-287"></span><span class="hs-identifier">sTANDARD_RIGHTS_EXECUTE</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131072</span><span>
</span><span id="line-288"></span><span class="hs-identifier">sTANDARD_RIGHTS_ALL</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-289"></span><span class="hs-identifier">sTANDARD_RIGHTS_ALL</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2031616</span><span>
</span><span id="line-290"></span><span class="hs-identifier">sPECIFIC_RIGHTS_ALL</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-291"></span><span class="hs-identifier">sPECIFIC_RIGHTS_ALL</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">65535</span><span>
</span><span id="line-292"></span><span class="hs-identifier">aCCESS_SYSTEM_SECURITY</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-293"></span><span class="hs-identifier">aCCESS_SYSTEM_SECURITY</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16777216</span><span>
</span><span id="line-294"></span><span class="hs-identifier">mAXIMUM_ALLOWED</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-295"></span><span class="hs-identifier">mAXIMUM_ALLOWED</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">33554432</span><span>
</span><span id="line-296"></span><span class="hs-identifier">fILE_ADD_FILE</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-297"></span><span class="hs-identifier">fILE_ADD_FILE</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-298"></span><span class="hs-identifier">fILE_ADD_SUBDIRECTORY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-299"></span><span class="hs-identifier">fILE_ADD_SUBDIRECTORY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-300"></span><span class="hs-identifier">fILE_ALL_ACCESS</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-301"></span><span class="hs-identifier">fILE_ALL_ACCESS</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2032127</span><span>
</span><span id="line-302"></span><span class="hs-identifier">fILE_APPEND_DATA</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-303"></span><span class="hs-identifier">fILE_APPEND_DATA</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-304"></span><span class="hs-identifier">fILE_CREATE_PIPE_INSTANCE</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-305"></span><span class="hs-identifier">fILE_CREATE_PIPE_INSTANCE</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-306"></span><span class="hs-identifier">fILE_DELETE_CHILD</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-307"></span><span class="hs-identifier">fILE_DELETE_CHILD</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">64</span><span>
</span><span id="line-308"></span><span class="hs-identifier">fILE_EXECUTE</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-309"></span><span class="hs-identifier">fILE_EXECUTE</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-310"></span><span class="hs-identifier">fILE_LIST_DIRECTORY</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-311"></span><span class="hs-identifier">fILE_LIST_DIRECTORY</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-312"></span><span class="hs-identifier">fILE_READ_ATTRIBUTES</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-313"></span><span class="hs-identifier">fILE_READ_ATTRIBUTES</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">128</span><span>
</span><span id="line-314"></span><span class="hs-identifier">fILE_READ_DATA</span><span>             </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-315"></span><span class="hs-identifier">fILE_READ_DATA</span><span>             </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-316"></span><span class="hs-identifier">fILE_READ_EA</span><span>               </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-317"></span><span class="hs-identifier">fILE_READ_EA</span><span>               </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-318"></span><span class="hs-identifier">fILE_TRAVERSE</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-319"></span><span class="hs-identifier">fILE_TRAVERSE</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-320"></span><span class="hs-identifier">fILE_WRITE_ATTRIBUTES</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-321"></span><span class="hs-identifier">fILE_WRITE_ATTRIBUTES</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-322"></span><span class="hs-identifier">fILE_WRITE_DATA</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-323"></span><span class="hs-identifier">fILE_WRITE_DATA</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-324"></span><span class="hs-identifier">fILE_WRITE_EA</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">AccessMode</span><span>
</span><span id="line-325"></span><span class="hs-identifier">fILE_WRITE_EA</span><span>              </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span class="hs-pragma">{-# LINE 296 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-296"></span><span>
</span><span id="line-297"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-298"></span><span>
</span><span id="line-299"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">ShareMode</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span class="hs-identifier">fILE_SHARE_NONE</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ShareMode</span><span>
</span><span id="line-302"></span><span class="hs-identifier">fILE_SHARE_NONE</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span class="hs-identifier">fILE_SHARE_READ</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ShareMode</span><span>
</span><span id="line-305"></span><span class="hs-identifier">fILE_SHARE_READ</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-306"></span><span class="hs-identifier">fILE_SHARE_WRITE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ShareMode</span><span>
</span><span id="line-307"></span><span class="hs-identifier">fILE_SHARE_WRITE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-308"></span><span class="hs-identifier">fILE_SHARE_DELETE</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ShareMode</span><span>
</span><span id="line-309"></span><span class="hs-identifier">fILE_SHARE_DELETE</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="hs-pragma">{-# LINE 309 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-311"></span><span>
</span><span id="line-312"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">CreateMode</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-313"></span><span>
</span><span id="line-314"></span><span class="hs-identifier">cREATE_NEW</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CreateMode</span><span>
</span><span id="line-315"></span><span class="hs-identifier">cREATE_NEW</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-316"></span><span class="hs-identifier">cREATE_ALWAYS</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CreateMode</span><span>
</span><span id="line-317"></span><span class="hs-identifier">cREATE_ALWAYS</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-318"></span><span class="hs-identifier">oPEN_EXISTING</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CreateMode</span><span>
</span><span id="line-319"></span><span class="hs-identifier">oPEN_EXISTING</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-320"></span><span class="hs-identifier">oPEN_ALWAYS</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CreateMode</span><span>
</span><span id="line-321"></span><span class="hs-identifier">oPEN_ALWAYS</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-322"></span><span class="hs-identifier">tRUNCATE_EXISTING</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">CreateMode</span><span>
</span><span id="line-323"></span><span class="hs-identifier">tRUNCATE_EXISTING</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">5</span><span>
</span><span id="line-324"></span><span>
</span><span id="line-325"></span><span class="hs-pragma">{-# LINE 321 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="hs-identifier">fILE_ATTRIBUTE_READONLY</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-327"></span><span class="hs-identifier">fILE_ATTRIBUTE_READONLY</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-328"></span><span class="hs-identifier">fILE_ATTRIBUTE_HIDDEN</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-329"></span><span class="hs-identifier">fILE_ATTRIBUTE_HIDDEN</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-330"></span><span class="hs-identifier">fILE_ATTRIBUTE_SYSTEM</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-331"></span><span class="hs-identifier">fILE_ATTRIBUTE_SYSTEM</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-332"></span><span class="hs-identifier">fILE_ATTRIBUTE_DIRECTORY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-333"></span><span class="hs-identifier">fILE_ATTRIBUTE_DIRECTORY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-334"></span><span class="hs-identifier">fILE_ATTRIBUTE_ARCHIVE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-335"></span><span class="hs-identifier">fILE_ATTRIBUTE_ARCHIVE</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32</span><span>
</span><span id="line-336"></span><span class="hs-identifier">fILE_ATTRIBUTE_NORMAL</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-337"></span><span class="hs-identifier">fILE_ATTRIBUTE_NORMAL</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">128</span><span>
</span><span id="line-338"></span><span class="hs-identifier">fILE_ATTRIBUTE_TEMPORARY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-339"></span><span class="hs-identifier">fILE_ATTRIBUTE_TEMPORARY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-340"></span><span class="hs-identifier">fILE_ATTRIBUTE_COMPRESSED</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-341"></span><span class="hs-identifier">fILE_ATTRIBUTE_COMPRESSED</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2048</span><span>
</span><span id="line-342"></span><span class="hs-identifier">fILE_ATTRIBUTE_REPARSE_POINT</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-343"></span><span class="hs-identifier">fILE_ATTRIBUTE_REPARSE_POINT</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1024</span><span>
</span><span id="line-344"></span><span class="hs-identifier">fILE_FLAG_WRITE_THROUGH</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-345"></span><span class="hs-identifier">fILE_FLAG_WRITE_THROUGH</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2147483648</span><span>
</span><span id="line-346"></span><span class="hs-identifier">fILE_FLAG_OVERLAPPED</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-347"></span><span class="hs-identifier">fILE_FLAG_OVERLAPPED</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1073741824</span><span>
</span><span id="line-348"></span><span class="hs-identifier">fILE_FLAG_NO_BUFFERING</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-349"></span><span class="hs-identifier">fILE_FLAG_NO_BUFFERING</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">536870912</span><span>
</span><span id="line-350"></span><span class="hs-identifier">fILE_FLAG_RANDOM_ACCESS</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-351"></span><span class="hs-identifier">fILE_FLAG_RANDOM_ACCESS</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">268435456</span><span>
</span><span id="line-352"></span><span class="hs-identifier">fILE_FLAG_SEQUENTIAL_SCAN</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-353"></span><span class="hs-identifier">fILE_FLAG_SEQUENTIAL_SCAN</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">134217728</span><span>
</span><span id="line-354"></span><span class="hs-identifier">fILE_FLAG_DELETE_ON_CLOSE</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-355"></span><span class="hs-identifier">fILE_FLAG_DELETE_ON_CLOSE</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">67108864</span><span>
</span><span id="line-356"></span><span class="hs-identifier">fILE_FLAG_BACKUP_SEMANTICS</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-357"></span><span class="hs-identifier">fILE_FLAG_BACKUP_SEMANTICS</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">33554432</span><span>
</span><span id="line-358"></span><span class="hs-identifier">fILE_FLAG_POSIX_SEMANTICS</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-359"></span><span class="hs-identifier">fILE_FLAG_POSIX_SEMANTICS</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16777216</span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="hs-pragma">{-# LINE 345 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span class="hs-pragma">{-# LINE 346 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-346"></span><span class="hs-identifier">sECURITY_ANONYMOUS</span><span>            </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-347"></span><span class="hs-identifier">sECURITY_ANONYMOUS</span><span>            </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-348"></span><span class="hs-identifier">sECURITY_IDENTIFICATION</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-349"></span><span class="hs-identifier">sECURITY_IDENTIFICATION</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">65536</span><span>
</span><span id="line-350"></span><span class="hs-identifier">sECURITY_IMPERSONATION</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-351"></span><span class="hs-identifier">sECURITY_IMPERSONATION</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">131072</span><span>
</span><span id="line-352"></span><span class="hs-identifier">sECURITY_DELEGATION</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-353"></span><span class="hs-identifier">sECURITY_DELEGATION</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">196608</span><span>
</span><span id="line-354"></span><span class="hs-identifier">sECURITY_CONTEXT_TRACKING</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-355"></span><span class="hs-identifier">sECURITY_CONTEXT_TRACKING</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">262144</span><span>
</span><span id="line-356"></span><span class="hs-identifier">sECURITY_EFFECTIVE_ONLY</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-357"></span><span class="hs-identifier">sECURITY_EFFECTIVE_ONLY</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">524288</span><span>
</span><span id="line-358"></span><span class="hs-identifier">sECURITY_SQOS_PRESENT</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-359"></span><span class="hs-identifier">sECURITY_SQOS_PRESENT</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1048576</span><span>
</span><span id="line-360"></span><span class="hs-identifier">sECURITY_VALID_SQOS_FLAGS</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-361"></span><span class="hs-identifier">sECURITY_VALID_SQOS_FLAGS</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2031616</span><span>
</span><span id="line-362"></span><span>
</span><span id="line-363"></span><span class="hs-pragma">{-# LINE 356 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-356"></span><span>
</span><span id="line-357"></span><span class="hs-pragma">{-# LINE 357 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-357"></span><span>
</span><span id="line-358"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-359"></span><span>
</span><span id="line-360"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-361"></span><span>
</span><span id="line-362"></span><span class="hs-identifier">mOVEFILE_REPLACE_EXISTING</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span>
</span><span id="line-363"></span><span class="hs-identifier">mOVEFILE_REPLACE_EXISTING</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-364"></span><span class="hs-identifier">mOVEFILE_COPY_ALLOWED</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span>
</span><span id="line-365"></span><span class="hs-identifier">mOVEFILE_COPY_ALLOWED</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-366"></span><span class="hs-identifier">mOVEFILE_DELAY_UNTIL_REBOOT</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span>
</span><span id="line-367"></span><span class="hs-identifier">mOVEFILE_DELAY_UNTIL_REBOOT</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-pragma">{-# LINE 367 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-367"></span><span>
</span><span id="line-368"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-369"></span><span>
</span><span id="line-370"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-371"></span><span>
</span><span id="line-372"></span><span class="hs-identifier">fILE_BEGIN</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span>
</span><span id="line-373"></span><span class="hs-identifier">fILE_BEGIN</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-374"></span><span class="hs-identifier">fILE_CURRENT</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span>
</span><span id="line-375"></span><span class="hs-identifier">fILE_CURRENT</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-376"></span><span class="hs-identifier">fILE_END</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span>
</span><span id="line-377"></span><span class="hs-identifier">fILE_END</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span class="hs-pragma">{-# LINE 377 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-379"></span><span>
</span><span id="line-380"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">DriveType</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-381"></span><span>
</span><span id="line-382"></span><span class="hs-identifier">dRIVE_UNKNOWN</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-383"></span><span class="hs-identifier">dRIVE_UNKNOWN</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-384"></span><span class="hs-identifier">dRIVE_NO_ROOT_DIR</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-385"></span><span class="hs-identifier">dRIVE_NO_ROOT_DIR</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-386"></span><span class="hs-identifier">dRIVE_REMOVABLE</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-387"></span><span class="hs-identifier">dRIVE_REMOVABLE</span><span>       </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-388"></span><span class="hs-identifier">dRIVE_FIXED</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-389"></span><span class="hs-identifier">dRIVE_FIXED</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-390"></span><span class="hs-identifier">dRIVE_REMOTE</span><span>          </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-391"></span><span class="hs-identifier">dRIVE_REMOTE</span><span>          </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-392"></span><span class="hs-identifier">dRIVE_CDROM</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-393"></span><span class="hs-identifier">dRIVE_CDROM</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">5</span><span>
</span><span id="line-394"></span><span class="hs-identifier">dRIVE_RAMDISK</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DriveType</span><span>
</span><span id="line-395"></span><span class="hs-identifier">dRIVE_RAMDISK</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">6</span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span class="hs-pragma">{-# LINE 391 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-391"></span><span>
</span><span id="line-392"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-395"></span><span>
</span><span id="line-396"></span><span class="hs-identifier">dDD_RAW_TARGET_PATH</span><span>           </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span>
</span><span id="line-397"></span><span class="hs-identifier">dDD_RAW_TARGET_PATH</span><span>           </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-398"></span><span class="hs-identifier">dDD_REMOVE_DEFINITION</span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span>
</span><span id="line-399"></span><span class="hs-identifier">dDD_REMOVE_DEFINITION</span><span>         </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-400"></span><span class="hs-identifier">dDD_EXACT_MATCH_ON_REMOVE</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span>
</span><span id="line-401"></span><span class="hs-identifier">dDD_EXACT_MATCH_ON_REMOVE</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-402"></span><span>
</span><span id="line-403"></span><span class="hs-pragma">{-# LINE 401 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-401"></span><span>
</span><span id="line-402"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-403"></span><span>
</span><span id="line-404"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">BinaryType</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span class="hs-identifier">sCS_32BIT_BINARY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-407"></span><span class="hs-identifier">sCS_32BIT_BINARY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-408"></span><span class="hs-identifier">sCS_DOS_BINARY</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-409"></span><span class="hs-identifier">sCS_DOS_BINARY</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-410"></span><span class="hs-identifier">sCS_WOW_BINARY</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-411"></span><span class="hs-identifier">sCS_WOW_BINARY</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-412"></span><span class="hs-identifier">sCS_PIF_BINARY</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-413"></span><span class="hs-identifier">sCS_PIF_BINARY</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-414"></span><span class="hs-identifier">sCS_POSIX_BINARY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-415"></span><span class="hs-identifier">sCS_POSIX_BINARY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-416"></span><span class="hs-identifier">sCS_OS216_BINARY</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-417"></span><span class="hs-identifier">sCS_OS216_BINARY</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">5</span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span class="hs-pragma">{-# LINE 414 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-416"></span><span>
</span><span id="line-417"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-418"></span><span>
</span><span id="line-419"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_FILE_NAME</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-420"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_FILE_NAME</span><span>   </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-421"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_DIR_NAME</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-422"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_DIR_NAME</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-423"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_ATTRIBUTES</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-424"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_ATTRIBUTES</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">4</span><span>
</span><span id="line-425"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_SIZE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-426"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_SIZE</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">8</span><span>
</span><span id="line-427"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_LAST_WRITE</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-428"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_LAST_WRITE</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">16</span><span>
</span><span id="line-429"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_SECURITY</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span>
</span><span id="line-430"></span><span class="hs-identifier">fILE_NOTIFY_CHANGE_SECURITY</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">256</span><span>
</span><span id="line-431"></span><span>
</span><span id="line-432"></span><span class="hs-pragma">{-# LINE 427 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-427"></span><span>
</span><span id="line-428"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">FileType</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-431"></span><span>
</span><span id="line-432"></span><span class="hs-identifier">fILE_TYPE_UNKNOWN</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-433"></span><span class="hs-identifier">fILE_TYPE_UNKNOWN</span><span>     </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">0</span><span>
</span><span id="line-434"></span><span class="hs-identifier">fILE_TYPE_DISK</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-435"></span><span class="hs-identifier">fILE_TYPE_DISK</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-436"></span><span class="hs-identifier">fILE_TYPE_CHAR</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-437"></span><span class="hs-identifier">fILE_TYPE_CHAR</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-438"></span><span class="hs-identifier">fILE_TYPE_PIPE</span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-439"></span><span class="hs-identifier">fILE_TYPE_PIPE</span><span>        </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">3</span><span>
</span><span id="line-440"></span><span class="hs-identifier">fILE_TYPE_REMOTE</span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-441"></span><span class="hs-identifier">fILE_TYPE_REMOTE</span><span>      </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">32768</span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-pragma">{-# LINE 439 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-439"></span><span>
</span><span id="line-440"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-441"></span><span>
</span><span id="line-442"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">LockMode</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-443"></span><span>
</span><span id="line-444"></span><span class="hs-identifier">lOCKFILE_EXCLUSIVE_LOCK</span><span>    </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LockMode</span><span>
</span><span id="line-445"></span><span class="hs-identifier">lOCKFILE_EXCLUSIVE_LOCK</span><span>    </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">2</span><span>
</span><span id="line-446"></span><span class="hs-identifier">lOCKFILE_FAIL_IMMEDIATELY</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LockMode</span><span>
</span><span id="line-447"></span><span class="hs-identifier">lOCKFILE_FAIL_IMMEDIATELY</span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="hs-number">1</span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span class="hs-pragma">{-# LINE 448 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-448"></span><span>
</span><span id="line-449"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-keyword">newtype</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Word32</span><span class="hs-special">)</span><span>
</span><span id="line-452"></span><span class="hs-pragma">{-# LINE 452 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-452"></span><span>    </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Eq</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">Ord</span><span class="hs-special">)</span><span>
</span><span id="line-453"></span><span>
</span><span id="line-454"></span><span class="hs-identifier">getFileExInfoStandard</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span>
</span><span id="line-455"></span><span class="hs-identifier">getFileExInfoStandard</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span> </span><span class="hs-number">0</span><span>
</span><span id="line-456"></span><span class="hs-identifier">getFileExMaxInfoLevel</span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span>
</span><span id="line-457"></span><span class="hs-identifier">getFileExMaxInfoLevel</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span> </span><span class="hs-number">1</span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="hs-pragma">{-# LINE 458 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-458"></span><span>
</span><span id="line-459"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-460"></span><span>
</span><span id="line-461"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span>
</span><span id="line-462"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">nLength</span><span>              </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-463"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">lpSecurityDescriptor</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-identifier">LPVOID</span><span>
</span><span id="line-464"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bInheritHandle</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-465"></span><span>    </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-identifier">Show</span><span>
</span><span id="line-466"></span><span>
</span><span id="line-467"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">PSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span>
</span><span id="line-468"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span>
</span><span id="line-469"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MbLPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span>
</span><span id="line-470"></span><span>
</span><span id="line-471"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-472"></span><span>    </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-number">24</span><span class="hs-special">)</span><span>
</span><span id="line-473"></span><span class="hs-pragma">{-# LINE 473 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-473"></span><span>    </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">8</span><span>
</span><span id="line-474"></span><span class="hs-pragma">{-# LINE 474 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-474"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">input</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-475"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>              </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">nLength</span><span> </span><span class="hs-identifier">input</span><span class="hs-special">)</span><span>
</span><span id="line-476"></span><span class="hs-pragma">{-# LINE 476 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-476"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">lpSecurityDescriptor</span><span> </span><span class="hs-identifier">input</span><span class="hs-special">)</span><span>
</span><span id="line-477"></span><span class="hs-pragma">{-# LINE 477 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-477"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bInheritHandle</span><span> </span><span class="hs-identifier">input</span><span class="hs-special">)</span><span>
</span><span id="line-478"></span><span class="hs-pragma">{-# LINE 478 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-478"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-479"></span><span>        </span><span class="hs-identifier">nLength'</span><span>              </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>              </span><span class="hs-identifier">buf</span><span>
</span><span id="line-480"></span><span class="hs-pragma">{-# LINE 480 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-480"></span><span>        </span><span class="hs-identifier">lpSecurityDescriptor'</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-481"></span><span class="hs-pragma">{-# LINE 481 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-481"></span><span>        </span><span class="hs-identifier">bInheritHandle'</span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span>
</span><span id="line-482"></span><span class="hs-pragma">{-# LINE 482 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-482"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">SECURITY_ATTRIBUTES</span><span> </span><span class="hs-identifier">nLength'</span><span> </span><span class="hs-identifier">lpSecurityDescriptor'</span><span> </span><span class="hs-identifier">bInheritHandle'</span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-485"></span><span class="hs-comment">-- Other types</span><span>
</span><span id="line-486"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-487"></span><span>
</span><span id="line-488"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span>
</span><span id="line-489"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">bhfiFileAttributes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-490"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiCreationTime</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiLastAccessTime</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiLastWriteTime</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FILETIME</span><span>
</span><span id="line-491"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiVolumeSerialNumber</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-492"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiSize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DDWORD</span><span>
</span><span id="line-493"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiNumberOfLinks</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-494"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bhfiFileIndex</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DDWORD</span><span>
</span><span id="line-495"></span><span>    </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Show</span><span class="hs-special">)</span><span>
</span><span id="line-496"></span><span>
</span><span id="line-497"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-498"></span><span>    </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-number">52</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-499"></span><span class="hs-pragma">{-# LINE 499 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-499"></span><span>    </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">4</span><span>
</span><span id="line-500"></span><span class="hs-pragma">{-# LINE 500 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-500"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">bhi</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-501"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>     </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bhfiFileAttributes</span><span> </span><span class="hs-identifier">bhi</span><span class="hs-special">)</span><span>
</span><span id="line-502"></span><span class="hs-pragma">{-# LINE 502 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-502"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bhfiCreationTime</span><span> </span><span class="hs-identifier">bhi</span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span class="hs-pragma">{-# LINE 503 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-503"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">12</span><span class="hs-special">)</span><span class="hs-special">)</span><span>     </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bhfiLastAccessTime</span><span> </span><span class="hs-identifier">bhi</span><span class="hs-special">)</span><span>
</span><span id="line-504"></span><span class="hs-pragma">{-# LINE 504 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-504"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">20</span><span class="hs-special">)</span><span class="hs-special">)</span><span>      </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bhfiLastWriteTime</span><span> </span><span class="hs-identifier">bhi</span><span class="hs-special">)</span><span>
</span><span id="line-505"></span><span class="hs-pragma">{-# LINE 505 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-505"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">28</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bhfiVolumeSerialNumber</span><span> </span><span class="hs-identifier">bhi</span><span class="hs-special">)</span><span>
</span><span id="line-506"></span><span class="hs-pragma">{-# LINE 506 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-506"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">sizeHi</span><span>
</span><span id="line-507"></span><span class="hs-pragma">{-# LINE 507 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-507"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">36</span><span class="hs-special">)</span><span class="hs-special">)</span><span>         </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">sizeLow</span><span>
</span><span id="line-508"></span><span class="hs-pragma">{-# LINE 508 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-508"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">40</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">bhfiNumberOfLinks</span><span> </span><span class="hs-identifier">bhi</span><span class="hs-special">)</span><span>
</span><span id="line-509"></span><span class="hs-pragma">{-# LINE 509 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-509"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">44</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">idxHi</span><span>
</span><span id="line-510"></span><span class="hs-pragma">{-# LINE 510 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-510"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">48</span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">idxLow</span><span>
</span><span id="line-511"></span><span class="hs-pragma">{-# LINE 511 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-511"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-512"></span><span>            </span><span class="hs-special">(</span><span class="hs-identifier">sizeHi</span><span class="hs-special">,</span><span class="hs-identifier">sizeLow</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ddwordToDwords</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">bhfiSize</span><span> </span><span class="hs-identifier">bhi</span><span>
</span><span id="line-513"></span><span>            </span><span class="hs-special">(</span><span class="hs-identifier">idxHi</span><span class="hs-special">,</span><span class="hs-identifier">idxLow</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ddwordToDwords</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">bhfiFileIndex</span><span> </span><span class="hs-identifier">bhi</span><span>
</span><span id="line-514"></span><span>
</span><span id="line-515"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-516"></span><span>        </span><span class="hs-identifier">attr</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span>     </span><span class="hs-identifier">buf</span><span>
</span><span id="line-517"></span><span class="hs-pragma">{-# LINE 517 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-517"></span><span>        </span><span class="hs-identifier">ctim</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span>
</span><span id="line-518"></span><span class="hs-pragma">{-# LINE 518 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-518"></span><span>        </span><span class="hs-identifier">lati</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">12</span><span class="hs-special">)</span><span class="hs-special">)</span><span>     </span><span class="hs-identifier">buf</span><span>
</span><span id="line-519"></span><span class="hs-pragma">{-# LINE 519 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-519"></span><span>        </span><span class="hs-identifier">lwti</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">20</span><span class="hs-special">)</span><span class="hs-special">)</span><span>      </span><span class="hs-identifier">buf</span><span>
</span><span id="line-520"></span><span class="hs-pragma">{-# LINE 520 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-520"></span><span>        </span><span class="hs-identifier">vser</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">28</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-521"></span><span class="hs-pragma">{-# LINE 521 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-521"></span><span>        </span><span class="hs-identifier">fshi</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-identifier">buf</span><span>
</span><span id="line-522"></span><span class="hs-pragma">{-# LINE 522 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-522"></span><span>        </span><span class="hs-identifier">fslo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">36</span><span class="hs-special">)</span><span class="hs-special">)</span><span>         </span><span class="hs-identifier">buf</span><span>
</span><span id="line-523"></span><span class="hs-pragma">{-# LINE 523 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-523"></span><span>        </span><span class="hs-identifier">link</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">40</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span>
</span><span id="line-524"></span><span class="hs-pragma">{-# LINE 524 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-524"></span><span>        </span><span class="hs-identifier">idhi</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">44</span><span class="hs-special">)</span><span class="hs-special">)</span><span>       </span><span class="hs-identifier">buf</span><span>
</span><span id="line-525"></span><span class="hs-pragma">{-# LINE 525 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-525"></span><span>        </span><span class="hs-identifier">idlo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">48</span><span class="hs-special">)</span><span class="hs-special">)</span><span>        </span><span class="hs-identifier">buf</span><span>
</span><span id="line-526"></span><span class="hs-pragma">{-# LINE 526 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-526"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span> </span><span class="hs-identifier">attr</span><span> </span><span class="hs-identifier">ctim</span><span> </span><span class="hs-identifier">lati</span><span> </span><span class="hs-identifier">lwti</span><span> </span><span class="hs-identifier">vser</span><span>
</span><span id="line-527"></span><span>            </span><span class="hs-special">(</span><span class="hs-identifier">dwordsToDdword</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fshi</span><span class="hs-special">,</span><span class="hs-identifier">fslo</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">link</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">dwordsToDdword</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">idhi</span><span class="hs-special">,</span><span class="hs-identifier">idlo</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-528"></span><span>
</span><span id="line-529"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-530"></span><span>
</span><span id="line-531"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">WIN32_FILE_ATTRIBUTE_DATA</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WIN32_FILE_ATTRIBUTE_DATA</span><span>
</span><span id="line-532"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">fadFileAttributes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-533"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fadCreationTime</span><span> </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fadLastAccessTime</span><span> </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fadLastWriteTime</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FILETIME</span><span>
</span><span id="line-534"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">fadFileSize</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DDWORD</span><span>
</span><span id="line-535"></span><span>    </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Show</span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span>
</span><span id="line-537"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">WIN32_FILE_ATTRIBUTE_DATA</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-538"></span><span>    </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-number">36</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-539"></span><span class="hs-pragma">{-# LINE 539 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-539"></span><span>    </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">4</span><span>
</span><span id="line-540"></span><span class="hs-pragma">{-# LINE 540 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-540"></span><span>    </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">ad</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-541"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fadFileAttributes</span><span> </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span class="hs-pragma">{-# LINE 542 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-542"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span class="hs-special">)</span><span>   </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fadCreationTime</span><span> </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-543"></span><span class="hs-pragma">{-# LINE 543 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-543"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">12</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fadLastAccessTime</span><span> </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-544"></span><span class="hs-pragma">{-# LINE 544 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-544"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">20</span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fadLastWriteTime</span><span> </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-545"></span><span class="hs-pragma">{-# LINE 545 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-545"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">28</span><span class="hs-special">)</span><span class="hs-special">)</span><span>    </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">sizeHi</span><span>
</span><span id="line-546"></span><span class="hs-pragma">{-# LINE 546 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-546"></span><span>        </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>     </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">sizeLo</span><span>
</span><span id="line-547"></span><span class="hs-pragma">{-# LINE 547 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-547"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-548"></span><span>            </span><span class="hs-special">(</span><span class="hs-identifier">sizeHi</span><span class="hs-special">,</span><span class="hs-identifier">sizeLo</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">ddwordToDwords</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">fadFileSize</span><span> </span><span class="hs-identifier">ad</span><span>
</span><span id="line-549"></span><span>
</span><span id="line-550"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-551"></span><span>        </span><span class="hs-identifier">attr</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-552"></span><span class="hs-pragma">{-# LINE 552 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-552"></span><span>        </span><span class="hs-identifier">ctim</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">4</span><span class="hs-special">)</span><span class="hs-special">)</span><span>   </span><span class="hs-identifier">buf</span><span>
</span><span id="line-553"></span><span class="hs-pragma">{-# LINE 553 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-553"></span><span>        </span><span class="hs-identifier">lati</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">12</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-554"></span><span class="hs-pragma">{-# LINE 554 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-554"></span><span>        </span><span class="hs-identifier">lwti</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">20</span><span class="hs-special">)</span><span class="hs-special">)</span><span>  </span><span class="hs-identifier">buf</span><span>
</span><span id="line-555"></span><span class="hs-pragma">{-# LINE 555 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-555"></span><span>        </span><span class="hs-identifier">fshi</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">28</span><span class="hs-special">)</span><span class="hs-special">)</span><span>    </span><span class="hs-identifier">buf</span><span>
</span><span id="line-556"></span><span class="hs-pragma">{-# LINE 556 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-556"></span><span>        </span><span class="hs-identifier">fslo</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>     </span><span class="hs-identifier">buf</span><span>
</span><span id="line-557"></span><span class="hs-pragma">{-# LINE 557 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-557"></span><span>        </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">WIN32_FILE_ATTRIBUTE_DATA</span><span> </span><span class="hs-identifier">attr</span><span> </span><span class="hs-identifier">ctim</span><span> </span><span class="hs-identifier">lati</span><span> </span><span class="hs-identifier">lwti</span><span>
</span><span id="line-558"></span><span>            </span><span class="hs-special">(</span><span class="hs-identifier">dwordsToDdword</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">fshi</span><span class="hs-special">,</span><span class="hs-identifier">fslo</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-559"></span><span>
</span><span id="line-560"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-561"></span><span class="hs-comment">-- File operations</span><span>
</span><span id="line-562"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-563"></span><span>
</span><span id="line-564"></span><span class="hs-comment">-- | like failIfFalse_, but retried on sharing violations.</span><span>
</span><span id="line-565"></span><span class="hs-comment">-- This is necessary for many file operations; see</span><span>
</span><span id="line-566"></span><span class="hs-comment">--   http://support.microsoft.com/kb/316609</span><span>
</span><span id="line-567"></span><span class="hs-comment">--</span><span>
</span><span id="line-568"></span><span class="hs-identifier">failIfWithRetry</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span>
</span><span id="line-569"></span><span class="hs-identifier">failIfWithRetry</span><span> </span><span class="hs-identifier">cond</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">action</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">retryOrFail</span><span> </span><span class="hs-identifier">retries</span><span>
</span><span id="line-570"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-571"></span><span>    </span><span class="hs-identifier">delay</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">100</span><span class="hs-operator">*</span><span class="hs-number">1000</span><span> </span><span class="hs-comment">-- in ms, we use threadDelay</span><span>
</span><span id="line-572"></span><span>    </span><span class="hs-identifier">retries</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">20</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Int</span><span>
</span><span id="line-573"></span><span>      </span><span class="hs-comment">-- KB article recommends 250/5</span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span>    </span><span class="hs-comment">-- retryOrFail :: Int -&gt; IO a</span><span>
</span><span id="line-576"></span><span>    </span><span class="hs-identifier">retryOrFail</span><span> </span><span class="hs-identifier">times</span><span>
</span><span id="line-577"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">times</span><span> </span><span class="hs-operator">&lt;=</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">errorWin</span><span> </span><span class="hs-identifier">msg</span><span>
</span><span id="line-578"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-identifier">otherwise</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-579"></span><span>         </span><span class="hs-identifier">ret</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">action</span><span>
</span><span id="line-580"></span><span>         </span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">cond</span><span> </span><span class="hs-identifier">ret</span><span class="hs-special">)</span><span>
</span><span id="line-581"></span><span>            </span><span class="hs-keyword">then</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">ret</span><span>
</span><span id="line-582"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-583"></span><span>              </span><span class="hs-identifier">err_code</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">getLastError</span><span>
</span><span id="line-584"></span><span>              </span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">err_code</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-special">(</span><span class="hs-number">32</span><span class="hs-special">)</span><span>
</span><span id="line-585"></span><span class="hs-pragma">{-# LINE 585 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-585"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-identifier">threadDelay</span><span> </span><span class="hs-identifier">delay</span><span class="hs-special">;</span><span> </span><span class="hs-identifier">retryOrFail</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">times</span><span> </span><span class="hs-glyph">-</span><span> </span><span class="hs-number">1</span><span class="hs-special">)</span><span>
</span><span id="line-586"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="hs-identifier">errorWin</span><span> </span><span class="hs-identifier">msg</span><span>
</span><span id="line-587"></span><span>
</span><span id="line-588"></span><span class="hs-identifier">failIfWithRetry_</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-589"></span><span class="hs-identifier">failIfWithRetry_</span><span> </span><span class="hs-identifier">cond</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">action</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">void</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">failIfWithRetry</span><span> </span><span class="hs-identifier">cond</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-identifier">action</span><span>
</span><span id="line-590"></span><span>
</span><span id="line-591"></span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-592"></span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">failIfWithRetry_</span><span> </span><span class="hs-identifier">not</span><span>
</span><span id="line-593"></span><span>
</span><span id="line-594"></span><span class="hs-identifier">deleteFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-595"></span><span class="hs-identifier">deleteFile</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-596"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-597"></span><span>    </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;DeleteFile&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-598"></span><span>      </span><span class="hs-identifier">c_DeleteFile</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-599"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h DeleteFileW&quot;</span><span>
</span><span id="line-600"></span><span>  </span><span class="hs-identifier">c_DeleteFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-601"></span><span>
</span><span id="line-602"></span><span class="hs-identifier">copyFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-603"></span><span class="hs-identifier">copyFile</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">over</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-604"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_src</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-605"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_dest</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-606"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;CopyFile&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">src</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">dest</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-607"></span><span>    </span><span class="hs-identifier">c_CopyFile</span><span> </span><span class="hs-identifier">c_src</span><span> </span><span class="hs-identifier">c_dest</span><span> </span><span class="hs-identifier">over</span><span>
</span><span id="line-608"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CopyFileW&quot;</span><span>
</span><span id="line-609"></span><span>  </span><span class="hs-identifier">c_CopyFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-610"></span><span>
</span><span id="line-611"></span><span class="hs-identifier">moveFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-612"></span><span class="hs-identifier">moveFile</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-613"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_src</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-614"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_dest</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-615"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;MoveFile&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">src</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">dest</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-616"></span><span>    </span><span class="hs-identifier">c_MoveFile</span><span> </span><span class="hs-identifier">c_src</span><span> </span><span class="hs-identifier">c_dest</span><span>
</span><span id="line-617"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h MoveFileW&quot;</span><span>
</span><span id="line-618"></span><span>  </span><span class="hs-identifier">c_MoveFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-619"></span><span>
</span><span id="line-620"></span><span class="hs-identifier">moveFileEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-621"></span><span class="hs-identifier">moveFileEx</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-622"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">src</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_src</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-623"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">dest</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_dest</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-624"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;MoveFileEx&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">src</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">dest</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-625"></span><span>    </span><span class="hs-identifier">c_MoveFileEx</span><span> </span><span class="hs-identifier">c_src</span><span> </span><span class="hs-identifier">c_dest</span><span> </span><span class="hs-identifier">flags</span><span>
</span><span id="line-626"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h MoveFileExW&quot;</span><span>
</span><span id="line-627"></span><span>  </span><span class="hs-identifier">c_MoveFileEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">MoveFileFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-628"></span><span>
</span><span id="line-629"></span><span class="hs-identifier">setCurrentDirectory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-630"></span><span class="hs-identifier">setCurrentDirectory</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-631"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-632"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;SetCurrentDirectory&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-633"></span><span>    </span><span class="hs-identifier">c_SetCurrentDirectory</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-634"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetCurrentDirectoryW&quot;</span><span>
</span><span id="line-635"></span><span>  </span><span class="hs-identifier">c_SetCurrentDirectory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-636"></span><span>
</span><span id="line-637"></span><span class="hs-identifier">createDirectory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-638"></span><span class="hs-identifier">createDirectory</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">mb_attr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-639"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-640"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;CreateDirectory&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-641"></span><span>    </span><span class="hs-identifier">c_CreateDirectory</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_attr</span><span class="hs-special">)</span><span>
</span><span id="line-642"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CreateDirectoryW&quot;</span><span>
</span><span id="line-643"></span><span>  </span><span class="hs-identifier">c_CreateDirectory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span class="hs-identifier">createDirectoryEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-646"></span><span class="hs-identifier">createDirectoryEx</span><span> </span><span class="hs-identifier">template</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">mb_attr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-647"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">template</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_template</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-648"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-649"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;CreateDirectoryEx&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">template</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-650"></span><span>    </span><span class="hs-identifier">c_CreateDirectoryEx</span><span> </span><span class="hs-identifier">c_template</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_attr</span><span class="hs-special">)</span><span>
</span><span id="line-651"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CreateDirectoryExW&quot;</span><span>
</span><span id="line-652"></span><span>  </span><span class="hs-identifier">c_CreateDirectoryEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-653"></span><span>
</span><span id="line-654"></span><span class="hs-identifier">removeDirectory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-655"></span><span class="hs-identifier">removeDirectory</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-656"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-657"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;RemoveDirectory&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-658"></span><span>    </span><span class="hs-identifier">c_RemoveDirectory</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-659"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h RemoveDirectoryW&quot;</span><span>
</span><span id="line-660"></span><span>  </span><span class="hs-identifier">c_RemoveDirectory</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-661"></span><span>
</span><span id="line-662"></span><span class="hs-identifier">getBinaryType</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BinaryType</span><span>
</span><span id="line-663"></span><span class="hs-identifier">getBinaryType</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-664"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-665"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_btype</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-666"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;GetBinaryType&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-667"></span><span>    </span><span class="hs-identifier">c_GetBinaryType</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">p_btype</span><span>
</span><span id="line-668"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_btype</span><span>
</span><span id="line-669"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetBinaryTypeW&quot;</span><span>
</span><span id="line-670"></span><span>  </span><span class="hs-identifier">c_GetBinaryType</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-671"></span><span>
</span><span id="line-672"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-673"></span><span class="hs-comment">-- HANDLE operations</span><span>
</span><span id="line-674"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-675"></span><span>
</span><span id="line-676"></span><span class="hs-identifier">createFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">AccessMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ShareMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CreateMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-677"></span><span class="hs-identifier">createFile</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">access</span><span> </span><span class="hs-identifier">share</span><span> </span><span class="hs-identifier">mb_attr</span><span> </span><span class="hs-identifier">mode</span><span> </span><span class="hs-identifier">flag</span><span> </span><span class="hs-identifier">mb_h</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-678"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-679"></span><span>  </span><span class="hs-identifier">failIfWithRetry</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span class="hs-identifier">iNVALID_HANDLE_VALUE</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;CreateFile&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-680"></span><span>    </span><span class="hs-identifier">c_CreateFile</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">access</span><span> </span><span class="hs-identifier">share</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_attr</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">mode</span><span> </span><span class="hs-identifier">flag</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_h</span><span class="hs-special">)</span><span>
</span><span id="line-681"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CreateFileW&quot;</span><span>
</span><span id="line-682"></span><span>  </span><span class="hs-identifier">c_CreateFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">AccessMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">ShareMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPSECURITY_ATTRIBUTES</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">CreateMode</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-683"></span><span>
</span><span id="line-684"></span><span class="hs-identifier">closeHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-685"></span><span class="hs-identifier">closeHandle</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-686"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;CloseHandle&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_CloseHandle</span><span> </span><span class="hs-identifier">h</span><span>
</span><span id="line-687"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h CloseHandle&quot;</span><span>
</span><span id="line-688"></span><span>  </span><span class="hs-identifier">c_CloseHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-689"></span><span>
</span><span id="line-690"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetFileType&quot;</span><span>
</span><span id="line-691"></span><span>  </span><span class="hs-identifier">getFileType</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">FileType</span><span>
</span><span id="line-692"></span><span class="hs-comment">--Apparently no error code</span><span>
</span><span id="line-693"></span><span>
</span><span id="line-694"></span><span class="hs-identifier">flushFileBuffers</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-695"></span><span class="hs-identifier">flushFileBuffers</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-696"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;FlushFileBuffers&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_FlushFileBuffers</span><span> </span><span class="hs-identifier">h</span><span>
</span><span id="line-697"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FlushFileBuffers&quot;</span><span>
</span><span id="line-698"></span><span>  </span><span class="hs-identifier">c_FlushFileBuffers</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-699"></span><span>
</span><span id="line-700"></span><span class="hs-identifier">setEndOfFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-701"></span><span class="hs-identifier">setEndOfFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-702"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetEndOfFile&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetEndOfFile</span><span> </span><span class="hs-identifier">h</span><span>
</span><span id="line-703"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetEndOfFile&quot;</span><span>
</span><span id="line-704"></span><span>  </span><span class="hs-identifier">c_SetEndOfFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-705"></span><span>
</span><span id="line-706"></span><span class="hs-identifier">setFileAttributes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-707"></span><span class="hs-identifier">setFileAttributes</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">attr</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-708"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-709"></span><span>  </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;SetFileAttributes&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-710"></span><span>    </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetFileAttributes</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">attr</span><span>
</span><span id="line-711"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetFileAttributesW&quot;</span><span>
</span><span id="line-712"></span><span>  </span><span class="hs-identifier">c_SetFileAttributes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-713"></span><span>
</span><span id="line-714"></span><span class="hs-identifier">getFileAttributes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-715"></span><span class="hs-identifier">getFileAttributes</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-716"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-717"></span><span>  </span><span class="hs-identifier">failIfWithRetry</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-number">0xFFFFFFFF</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;GetFileAttributes&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">name</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-718"></span><span>    </span><span class="hs-identifier">c_GetFileAttributes</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-719"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetFileAttributesW&quot;</span><span>
</span><span id="line-720"></span><span>  </span><span class="hs-identifier">c_GetFileAttributes</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">FileAttributeOrFlag</span><span>
</span><span id="line-721"></span><span>
</span><span id="line-722"></span><span class="hs-identifier">getFileAttributesExStandard</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">WIN32_FILE_ATTRIBUTE_DATA</span><span>
</span><span id="line-723"></span><span class="hs-identifier">getFileAttributesExStandard</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">res</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-724"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-725"></span><span>    </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-string">&quot;getFileAttributesExStandard&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-726"></span><span>      </span><span class="hs-identifier">c_GetFileAttributesEx</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">getFileExInfoStandard</span><span> </span><span class="hs-identifier">res</span><span>
</span><span id="line-727"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">res</span><span>
</span><span id="line-728"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetFileAttributesExW&quot;</span><span>
</span><span id="line-729"></span><span>  </span><span class="hs-identifier">c_GetFileAttributesEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">GET_FILEEX_INFO_LEVELS</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-730"></span><span>
</span><span id="line-731"></span><span class="hs-identifier">getFileInformationByHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span>
</span><span id="line-732"></span><span class="hs-identifier">getFileInformationByHandle</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">res</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-733"></span><span>    </span><span class="hs-identifier">failIfFalseWithRetry_</span><span> </span><span class="hs-string">&quot;GetFileInformationByHandle&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetFileInformationByHandle</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">res</span><span>
</span><span id="line-734"></span><span>    </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">res</span><span>
</span><span id="line-735"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetFileInformationByHandle&quot;</span><span>
</span><span id="line-736"></span><span>    </span><span class="hs-identifier">c_GetFileInformationByHandle</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">BY_HANDLE_FILE_INFORMATION</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-737"></span><span>
</span><span id="line-738"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-739"></span><span class="hs-comment">-- Read/write files</span><span>
</span><span id="line-740"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-741"></span><span>
</span><span id="line-742"></span><span class="hs-comment">-- No support for this yet</span><span>
</span><span id="line-743"></span><span class="hs-keyword">data</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span>
</span><span id="line-744"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-identifier">ovl_internal</span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ULONG_PTR</span><span>
</span><span id="line-745"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ovl_internalHigh</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">ULONG_PTR</span><span>
</span><span id="line-746"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ovl_offset</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-747"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ovl_offsetHigh</span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-748"></span><span>               </span><span class="hs-special">,</span><span> </span><span class="hs-identifier">ovl_hEvent</span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-749"></span><span>               </span><span class="hs-special">}</span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Show</span><span class="hs-special">)</span><span>
</span><span id="line-750"></span><span>
</span><span id="line-751"></span><span class="hs-keyword">instance</span><span> </span><span class="hs-identifier">Storable</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-752"></span><span>  </span><span class="hs-identifier">sizeOf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">const</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-number">32</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-753"></span><span class="hs-pragma">{-# LINE 753 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-753"></span><span>  </span><span class="hs-identifier">alignment</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-number">8</span><span>
</span><span id="line-754"></span><span class="hs-pragma">{-# LINE 754 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-754"></span><span>  </span><span class="hs-identifier">poke</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">ad</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-755"></span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ovl_internal</span><span>     </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-756"></span><span class="hs-pragma">{-# LINE 756 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-756"></span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ovl_internalHigh</span><span> </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-757"></span><span class="hs-pragma">{-# LINE 757 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-757"></span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ovl_offset</span><span>       </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-758"></span><span class="hs-pragma">{-# LINE 758 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-758"></span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">20</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ovl_offsetHigh</span><span>   </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-759"></span><span class="hs-pragma">{-# LINE 759 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-759"></span><span>      </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">pokeByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ovl_hEvent</span><span>       </span><span class="hs-identifier">ad</span><span class="hs-special">)</span><span>
</span><span id="line-760"></span><span class="hs-pragma">{-# LINE 760 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-760"></span><span>
</span><span id="line-761"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-762"></span><span>      </span><span class="hs-identifier">intnl</span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">0</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-763"></span><span class="hs-pragma">{-# LINE 763 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-763"></span><span>      </span><span class="hs-identifier">intnl_high</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">8</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-764"></span><span class="hs-pragma">{-# LINE 764 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-764"></span><span>      </span><span class="hs-identifier">off</span><span>        </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">16</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-765"></span><span class="hs-pragma">{-# LINE 765 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-765"></span><span>      </span><span class="hs-identifier">off_high</span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">20</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-766"></span><span class="hs-pragma">{-# LINE 766 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-766"></span><span>      </span><span class="hs-identifier">hevnt</span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">peekByteOff</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-number">24</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">buf</span><span>
</span><span id="line-767"></span><span class="hs-pragma">{-# LINE 767 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-767"></span><span>      </span><span class="hs-identifier">return</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span> </span><span class="hs-identifier">intnl</span><span> </span><span class="hs-identifier">intnl_high</span><span> </span><span class="hs-identifier">off</span><span> </span><span class="hs-identifier">off_high</span><span> </span><span class="hs-identifier">hevnt</span><span>
</span><span id="line-768"></span><span>
</span><span id="line-769"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span>
</span><span id="line-770"></span><span>
</span><span id="line-771"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">MbLPOVERLAPPED</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span>
</span><span id="line-772"></span><span>
</span><span id="line-773"></span><span class="hs-comment">--Sigh - I give up &amp; prefix win32_ to the next two to avoid</span><span>
</span><span id="line-774"></span><span class="hs-comment">-- senseless Prelude name clashes. --sof.</span><span>
</span><span id="line-775"></span><span>
</span><span id="line-776"></span><span class="hs-identifier">win32_ReadFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-777"></span><span class="hs-identifier">win32_ReadFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">mb_over</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-778"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_n</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-779"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;ReadFile&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_ReadFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">p_n</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_over</span><span class="hs-special">)</span><span>
</span><span id="line-780"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_n</span><span>
</span><span id="line-781"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h ReadFile&quot;</span><span>
</span><span id="line-782"></span><span>  </span><span class="hs-identifier">c_ReadFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-783"></span><span>
</span><span id="line-784"></span><span class="hs-identifier">win32_WriteFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-785"></span><span class="hs-identifier">win32_WriteFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">mb_over</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-786"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_n</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-787"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;WriteFile&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_WriteFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">buf</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-identifier">p_n</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">maybePtr</span><span> </span><span class="hs-identifier">mb_over</span><span class="hs-special">)</span><span>
</span><span id="line-788"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_n</span><span>
</span><span id="line-789"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h WriteFile&quot;</span><span>
</span><span id="line-790"></span><span>  </span><span class="hs-identifier">c_WriteFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-791"></span><span>
</span><span id="line-792"></span><span class="hs-identifier">setFilePointerEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LARGE_INTEGER</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">LARGE_INTEGER</span><span>
</span><span id="line-793"></span><span class="hs-identifier">setFilePointerEx</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">dist</span><span> </span><span class="hs-identifier">dir</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-794"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">p_pos</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-795"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetFilePointerEx&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetFilePointerEx</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">dist</span><span> </span><span class="hs-identifier">p_pos</span><span> </span><span class="hs-identifier">dir</span><span>
</span><span id="line-796"></span><span>  </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_pos</span><span>
</span><span id="line-797"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetFilePointerEx&quot;</span><span>
</span><span id="line-798"></span><span>  </span><span class="hs-identifier">c_SetFilePointerEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LARGE_INTEGER</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">LARGE_INTEGER</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FilePtrDirection</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-799"></span><span>
</span><span id="line-800"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-801"></span><span class="hs-comment">-- File Notifications</span><span>
</span><span id="line-802"></span><span class="hs-comment">--</span><span>
</span><span id="line-803"></span><span class="hs-comment">-- Use these to initialise, &quot;increment&quot; and close a HANDLE you can wait</span><span>
</span><span id="line-804"></span><span class="hs-comment">-- on.</span><span>
</span><span id="line-805"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-806"></span><span>
</span><span id="line-807"></span><span class="hs-identifier">findFirstChangeNotification</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-808"></span><span class="hs-identifier">findFirstChangeNotification</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-identifier">watch</span><span> </span><span class="hs-identifier">flag</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-809"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-810"></span><span>  </span><span class="hs-identifier">failIfNull</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">unwords</span><span> </span><span class="hs-special">[</span><span class="hs-string">&quot;FindFirstChangeNotification&quot;</span><span class="hs-special">,</span><span class="hs-identifier">show</span><span> </span><span class="hs-identifier">path</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-811"></span><span>    </span><span class="hs-identifier">c_FindFirstChangeNotification</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-identifier">watch</span><span> </span><span class="hs-identifier">flag</span><span>
</span><span id="line-812"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FindFirstChangeNotificationW&quot;</span><span>
</span><span id="line-813"></span><span>  </span><span class="hs-identifier">c_FindFirstChangeNotification</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FileNotificationFlag</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-814"></span><span>
</span><span id="line-815"></span><span class="hs-identifier">findNextChangeNotification</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-816"></span><span class="hs-identifier">findNextChangeNotification</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-817"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;FindNextChangeNotification&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_FindNextChangeNotification</span><span> </span><span class="hs-identifier">h</span><span>
</span><span id="line-818"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FindNextChangeNotification&quot;</span><span>
</span><span id="line-819"></span><span>  </span><span class="hs-identifier">c_FindNextChangeNotification</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-820"></span><span>
</span><span id="line-821"></span><span class="hs-identifier">findCloseChangeNotification</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-822"></span><span class="hs-identifier">findCloseChangeNotification</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-823"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;FindCloseChangeNotification&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_FindCloseChangeNotification</span><span> </span><span class="hs-identifier">h</span><span>
</span><span id="line-824"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FindCloseChangeNotification&quot;</span><span>
</span><span id="line-825"></span><span>  </span><span class="hs-identifier">c_FindCloseChangeNotification</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-826"></span><span>
</span><span id="line-827"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-828"></span><span class="hs-comment">-- Directories</span><span>
</span><span id="line-829"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-830"></span><span>
</span><span id="line-831"></span><span class="hs-keyword">type</span><span> </span><span class="hs-identifier">WIN32_FIND_DATA</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-832"></span><span>
</span><span id="line-833"></span><span class="hs-keyword">newtype</span><span> </span><span class="hs-identifier">FindData</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">FindData</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ForeignPtr</span><span> </span><span class="hs-identifier">WIN32_FIND_DATA</span><span class="hs-special">)</span><span>
</span><span id="line-834"></span><span>
</span><span id="line-835"></span><span class="hs-identifier">getFindDataFileName</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">FindData</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">FilePath</span><span>
</span><span id="line-836"></span><span class="hs-identifier">getFindDataFileName</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">FindData</span><span> </span><span class="hs-identifier">fp</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-837"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">fp</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">p</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-838"></span><span>    </span><span class="hs-identifier">peekTString</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-glyph">\</span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">hsc_ptr</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">plusPtr</span><span class="hs-special">`</span><span> </span><span class="hs-number">44</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-identifier">p</span><span class="hs-special">)</span><span>
</span><span id="line-839"></span><span class="hs-pragma">{-# LINE 839 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-839"></span><span>
</span><span id="line-840"></span><span class="hs-identifier">findFirstFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">HANDLE</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FindData</span><span class="hs-special">)</span><span>
</span><span id="line-841"></span><span class="hs-identifier">findFirstFile</span><span> </span><span class="hs-identifier">str</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-842"></span><span>  </span><span class="hs-identifier">fp_finddata</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">mallocForeignPtrBytes</span><span> </span><span class="hs-special">(</span><span class="hs-number">592</span><span class="hs-special">)</span><span>
</span><span id="line-843"></span><span class="hs-pragma">{-# LINE 843 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-843"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">fp_finddata</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">p_finddata</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-844"></span><span>    </span><span class="hs-identifier">handle</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">str</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">tstr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-845"></span><span>                </span><span class="hs-identifier">failIf</span><span> </span><span class="hs-special">(</span><span class="hs-operator">==</span><span> </span><span class="hs-identifier">iNVALID_HANDLE_VALUE</span><span class="hs-special">)</span><span> </span><span class="hs-string">&quot;findFirstFile&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-846"></span><span>                  </span><span class="hs-identifier">c_FindFirstFile</span><span> </span><span class="hs-identifier">tstr</span><span> </span><span class="hs-identifier">p_finddata</span><span>
</span><span id="line-847"></span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">handle</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">FindData</span><span> </span><span class="hs-identifier">fp_finddata</span><span class="hs-special">)</span><span>
</span><span id="line-848"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FindFirstFileW&quot;</span><span>
</span><span id="line-849"></span><span>  </span><span class="hs-identifier">c_FindFirstFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">WIN32_FIND_DATA</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">HANDLE</span><span>
</span><span id="line-850"></span><span>
</span><span id="line-851"></span><span class="hs-identifier">findNextFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">FindData</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span> </span><span class="hs-comment">-- False -&gt; no more files</span><span>
</span><span id="line-852"></span><span class="hs-identifier">findNextFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">FindData</span><span> </span><span class="hs-identifier">finddata</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-853"></span><span>  </span><span class="hs-identifier">withForeignPtr</span><span> </span><span class="hs-identifier">finddata</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">p_finddata</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-854"></span><span>    </span><span class="hs-identifier">b</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">c_FindNextFile</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-identifier">p_finddata</span><span>
</span><span id="line-855"></span><span>    </span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">b</span><span>
</span><span id="line-856"></span><span>       </span><span class="hs-keyword">then</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">True</span><span>
</span><span id="line-857"></span><span>       </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-858"></span><span>             </span><span class="hs-identifier">err_code</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">getLastError</span><span>
</span><span id="line-859"></span><span>             </span><span class="hs-keyword">if</span><span> </span><span class="hs-identifier">err_code</span><span> </span><span class="hs-operator">==</span><span> </span><span class="hs-special">(</span><span class="hs-number">18</span><span class="hs-special">)</span><span>
</span><span id="line-860"></span><span class="hs-pragma">{-# LINE 860 &quot;libraries\\Win32\\System\\Win32\\File.hsc&quot; #-}</span><span>
</span><span id="line-860"></span><span>                </span><span class="hs-keyword">then</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">False</span><span>
</span><span id="line-861"></span><span>                </span><span class="hs-keyword">else</span><span> </span><span class="hs-identifier">failWith</span><span> </span><span class="hs-string">&quot;findNextFile&quot;</span><span> </span><span class="hs-identifier">err_code</span><span>
</span><span id="line-862"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FindNextFileW&quot;</span><span>
</span><span id="line-863"></span><span>  </span><span class="hs-identifier">c_FindNextFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">WIN32_FIND_DATA</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-864"></span><span>
</span><span id="line-865"></span><span class="hs-identifier">findClose</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-866"></span><span class="hs-identifier">findClose</span><span> </span><span class="hs-identifier">h</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;findClose&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_FindClose</span><span> </span><span class="hs-identifier">h</span><span>
</span><span id="line-867"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h FindClose&quot;</span><span>
</span><span id="line-868"></span><span>  </span><span class="hs-identifier">c_FindClose</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-869"></span><span>
</span><span id="line-870"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-871"></span><span class="hs-comment">-- DOS Device flags</span><span>
</span><span id="line-872"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-873"></span><span>
</span><span id="line-874"></span><span class="hs-identifier">defineDosDevice</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-875"></span><span class="hs-identifier">defineDosDevice</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-876"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-877"></span><span>  </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-878"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;DefineDosDevice&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_DefineDosDevice</span><span> </span><span class="hs-identifier">flags</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-identifier">c_path</span><span>
</span><span id="line-879"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h DefineDosDeviceW&quot;</span><span>
</span><span id="line-880"></span><span>  </span><span class="hs-identifier">c_DefineDosDevice</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">DefineDosDeviceFlags</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-881"></span><span>
</span><span id="line-882"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-883"></span><span>
</span><span id="line-884"></span><span class="hs-comment">-- These functions are very unusual in the Win32 API:</span><span>
</span><span id="line-885"></span><span class="hs-comment">-- They dont return error codes</span><span>
</span><span id="line-886"></span><span>
</span><span id="line-887"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h AreFileApisANSI&quot;</span><span>
</span><span id="line-888"></span><span>  </span><span class="hs-identifier">areFileApisANSI</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-889"></span><span>
</span><span id="line-890"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetFileApisToOEM&quot;</span><span>
</span><span id="line-891"></span><span>  </span><span class="hs-identifier">setFileApisToOEM</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-892"></span><span>
</span><span id="line-893"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetFileApisToANSI&quot;</span><span>
</span><span id="line-894"></span><span>  </span><span class="hs-identifier">setFileApisToANSI</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-895"></span><span>
</span><span id="line-896"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetHandleCount&quot;</span><span>
</span><span id="line-897"></span><span>  </span><span class="hs-identifier">setHandleCount</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">UINT</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">UINT</span><span>
</span><span id="line-898"></span><span>
</span><span id="line-899"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-900"></span><span>
</span><span id="line-901"></span><span class="hs-identifier">getLogicalDrives</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-902"></span><span class="hs-identifier">getLogicalDrives</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-903"></span><span>  </span><span class="hs-identifier">failIfZero</span><span> </span><span class="hs-string">&quot;GetLogicalDrives&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_GetLogicalDrives</span><span>
</span><span id="line-904"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetLogicalDrives&quot;</span><span>
</span><span id="line-905"></span><span>  </span><span class="hs-identifier">c_GetLogicalDrives</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">DWORD</span><span>
</span><span id="line-906"></span><span>
</span><span id="line-907"></span><span class="hs-comment">-- %fun GetDriveType :: Maybe String -&gt; IO DriveType</span><span>
</span><span id="line-908"></span><span>
</span><span id="line-909"></span><span class="hs-identifier">getDiskFreeSpace</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span class="hs-identifier">DWORD</span><span class="hs-special">,</span><span class="hs-identifier">DWORD</span><span class="hs-special">)</span><span>
</span><span id="line-910"></span><span class="hs-identifier">getDiskFreeSpace</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-911"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-912"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_sectors</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-913"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_bytes</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-914"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_nfree</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-915"></span><span>  </span><span class="hs-identifier">alloca</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">p_nclusters</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-916"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;GetDiskFreeSpace&quot;</span><span> </span><span class="hs-operator">$</span><span>
</span><span id="line-917"></span><span>    </span><span class="hs-identifier">c_GetDiskFreeSpace</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-identifier">p_sectors</span><span> </span><span class="hs-identifier">p_bytes</span><span> </span><span class="hs-identifier">p_nfree</span><span> </span><span class="hs-identifier">p_nclusters</span><span>
</span><span id="line-918"></span><span>  </span><span class="hs-identifier">sectors</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_sectors</span><span>
</span><span id="line-919"></span><span>  </span><span class="hs-identifier">bytes</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_bytes</span><span>
</span><span id="line-920"></span><span>  </span><span class="hs-identifier">nfree</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_nfree</span><span>
</span><span id="line-921"></span><span>  </span><span class="hs-identifier">nclusters</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-identifier">peek</span><span> </span><span class="hs-identifier">p_nclusters</span><span>
</span><span id="line-922"></span><span>  </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">sectors</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">bytes</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">nfree</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">nclusters</span><span class="hs-special">)</span><span>
</span><span id="line-923"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h GetDiskFreeSpaceW&quot;</span><span>
</span><span id="line-924"></span><span>  </span><span class="hs-identifier">c_GetDiskFreeSpace</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Ptr</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-925"></span><span>
</span><span id="line-926"></span><span class="hs-identifier">setVolumeLabel</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">Maybe</span><span> </span><span class="hs-identifier">String</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-927"></span><span class="hs-identifier">setVolumeLabel</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-928"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">path</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-929"></span><span>  </span><span class="hs-identifier">maybeWith</span><span> </span><span class="hs-identifier">withTString</span><span> </span><span class="hs-identifier">name</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">c_name</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-930"></span><span>  </span><span class="hs-identifier">failIfFalse_</span><span> </span><span class="hs-string">&quot;SetVolumeLabel&quot;</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-identifier">c_SetVolumeLabel</span><span> </span><span class="hs-identifier">c_path</span><span> </span><span class="hs-identifier">c_name</span><span>
</span><span id="line-931"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;windows.h SetVolumeLabelW&quot;</span><span>
</span><span id="line-932"></span><span>  </span><span class="hs-identifier">c_SetVolumeLabel</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPCTSTR</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">Bool</span><span>
</span><span id="line-933"></span><span>
</span><span id="line-934"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- File locks</span><span>
</span><span id="line-936"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-937"></span><span>
</span><span id="line-938"></span><span class="hs-comment">-- | Locks a given range in a file handle, To lock an entire file</span><span>
</span><span id="line-939"></span><span class="hs-comment">--   use 0xFFFFFFFFFFFFFFFF for size and 0 for offset.</span><span>
</span><span id="line-940"></span><span class="hs-identifier">lockFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span>   </span><span class="hs-comment">-- ^ CreateFile handle</span><span>
</span><span id="line-941"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LockMode</span><span> </span><span class="hs-comment">-- ^ Locking mode</span><span>
</span><span id="line-942"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD64</span><span>  </span><span class="hs-comment">-- ^ Size of region to lock</span><span>
</span><span id="line-943"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD64</span><span>  </span><span class="hs-comment">-- ^ Beginning offset of file to lock</span><span>
</span><span id="line-944"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>  </span><span class="hs-comment">-- ^ Indicates if locking was successful, if not query</span><span>
</span><span id="line-945"></span><span>                     </span><span class="hs-comment">--   getLastError.</span><span>
</span><span id="line-946"></span><span class="hs-identifier">lockFile</span><span> </span><span class="hs-identifier">hwnd</span><span> </span><span class="hs-identifier">mode</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">f_offset</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-947"></span><span>  </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">s_low</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">size</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-number">0xFFFFFFFF</span><span class="hs-special">)</span><span>
</span><span id="line-948"></span><span>         </span><span class="hs-identifier">s_hi</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">size</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">shiftR</span><span class="hs-special">`</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span>
</span><span id="line-949"></span><span>         </span><span class="hs-identifier">o_low</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">f_offset</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-number">0xFFFFFFFF</span><span class="hs-special">)</span><span>
</span><span id="line-950"></span><span>         </span><span class="hs-identifier">o_hi</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">f_offset</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">shiftR</span><span class="hs-special">`</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span>
</span><span id="line-951"></span><span>         </span><span class="hs-identifier">ovlp</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">o_low</span><span> </span><span class="hs-identifier">o_hi</span><span> </span><span class="hs-identifier">nullPtr</span><span>
</span><span id="line-952"></span><span>     </span><span class="hs-identifier">with</span><span> </span><span class="hs-identifier">ovlp</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">c_LockFileEx</span><span> </span><span class="hs-identifier">hwnd</span><span> </span><span class="hs-identifier">mode</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">s_low</span><span> </span><span class="hs-identifier">s_hi</span><span> </span><span class="hs-identifier">ptr</span><span>
</span><span id="line-953"></span><span>
</span><span id="line-954"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;LockFileEx&quot;</span><span>
</span><span id="line-955"></span><span>  </span><span class="hs-identifier">c_LockFileEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span>
</span><span id="line-956"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-957"></span><span>
</span><span id="line-958"></span><span class="hs-comment">-- | Unlocks a given range in a file handle, To unlock an entire file</span><span>
</span><span id="line-959"></span><span class="hs-comment">--   use 0xFFFFFFFFFFFFFFFF for size and 0 for offset.</span><span>
</span><span id="line-960"></span><span class="hs-identifier">unlockFile</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span>  </span><span class="hs-comment">-- ^ CreateFile handle</span><span>
</span><span id="line-961"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD64</span><span> </span><span class="hs-comment">-- ^ Size of region to unlock</span><span>
</span><span id="line-962"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD64</span><span> </span><span class="hs-comment">-- ^ Beginning offset of file to unlock</span><span>
</span><span id="line-963"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span> </span><span class="hs-comment">-- ^ Indicates if unlocking was successful, if not query</span><span>
</span><span id="line-964"></span><span>                      </span><span class="hs-comment">--   getLastError.</span><span>
</span><span id="line-965"></span><span class="hs-identifier">unlockFile</span><span> </span><span class="hs-identifier">hwnd</span><span> </span><span class="hs-identifier">size</span><span> </span><span class="hs-identifier">f_offset</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-966"></span><span>  </span><span class="hs-keyword">do</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-identifier">s_low</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">size</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-number">0xFFFFFFFF</span><span class="hs-special">)</span><span>
</span><span id="line-967"></span><span>         </span><span class="hs-identifier">s_hi</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">size</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">shiftR</span><span class="hs-special">`</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span>
</span><span id="line-968"></span><span>         </span><span class="hs-identifier">o_low</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">f_offset</span><span> </span><span class="hs-operator">.&amp;.</span><span> </span><span class="hs-number">0xFFFFFFFF</span><span class="hs-special">)</span><span>
</span><span id="line-969"></span><span>         </span><span class="hs-identifier">o_hi</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">fromIntegral</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">f_offset</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">shiftR</span><span class="hs-special">`</span><span> </span><span class="hs-number">32</span><span class="hs-special">)</span><span>
</span><span id="line-970"></span><span>         </span><span class="hs-identifier">ovlp</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">OVERLAPPED</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">o_low</span><span> </span><span class="hs-identifier">o_hi</span><span> </span><span class="hs-identifier">nullPtr</span><span>
</span><span id="line-971"></span><span>     </span><span class="hs-identifier">with</span><span> </span><span class="hs-identifier">ovlp</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span class="hs-identifier">ptr</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">c_UnlockFileEx</span><span> </span><span class="hs-identifier">hwnd</span><span> </span><span class="hs-number">0</span><span> </span><span class="hs-identifier">s_low</span><span> </span><span class="hs-identifier">s_hi</span><span> </span><span class="hs-identifier">ptr</span><span>
</span><span id="line-972"></span><span>
</span><span id="line-973"></span><span class="hs-keyword">foreign</span><span> </span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">WINDOWS_CCONV</span><span> </span><span class="hs-keyword">unsafe</span><span> </span><span class="hs-string">&quot;UnlockFileEx&quot;</span><span>
</span><span id="line-974"></span><span>  </span><span class="hs-identifier">c_UnlockFileEx</span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-identifier">HANDLE</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">DWORD</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">LPOVERLAPPED</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">IO</span><span> </span><span class="hs-identifier">BOOL</span><span>
</span><span id="line-975"></span><span>
</span><span id="line-976"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-977"></span><span class="hs-comment">-- End</span><span>
</span><span id="line-978"></span><span class="hs-comment">----------------------------------------------------------------</span><span>
</span><span id="line-979"></span></pre></body></html>